Fix container-related misconfigurations in release build tasks #201
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please check if the PR fulfills these requirements
before creating one)
Bug fix.
What is the current behavior?
DistTasks.yml
contains the tasks used to produce the release builds of the project for each of the host targets. The builds are produced in Docker containers.Some regressions were introduced in these task at the time the project's Go version was bumped to 1.21.5 (which includes bumping the versions of the images used by the tasks: 1ccd378 / #174).
Linux_ARMv6
task.These regressions would cause the failure of the "Release" workflow run when it is triggered by a new release of the project.
What is the new behavior?
Use Debian 11 in
Linux_ARMv6
release build taskThe
Linux_ARMv6
task must use a specific version of Debian in the container:arduino-language-server/DistTasks.yml
Lines 147 to 174 in 5444eb5
The Debian version is defined via the image tag. Previously, Debian 10 was used, and a tag of the Go 1.18.3 image was available for this Debian version. However, the maintainers of the image did not produce a Debian 10 variant of the Go 1.21.5 image, so the use of that tag caused the task to fail:
https://github.com/per1234/arduino-language-server/actions/runs/11772916519/job/32789011179#step:4:36
A Debian 11 variant of the image is available, and this version of Debian is also suitable for release builds. So the solution is to update the image tag referenced in the task to the Debian 11 tag.
Configure repository for compatibility with modern Git versions in release build containers
As a security measure (see CVE-2022-24765), starting from 2.30.3 Git requires the repository folder to be owned by the operating system user's account. Due to it having been checked out outside the container, the repository does not meet this requirement inside the container. An older version of Git was installed in the Go 1.18.3 Docker image, so this was not a problem before the bump, but a newer version is used in the Go 1.21.5 containers, which causes some tasks to fail (elastic/golang-crossbuild#232):
https://github.com/per1234/arduino-language-server/actions/runs/11772976565/job/32789161736#step:4:148
https://github.com/per1234/arduino-language-server/actions/runs/11773011125/job/32789254088#step:4:146
https://github.com/per1234/arduino-language-server/actions/runs/11773011125/job/32789254192#step:4:161
The solution is to configure Git to allow the use of the repository, despite the "dubious ownership" of its folder. This is done via the
safe.directory
Git configuration variable.This approach is already in use in Arduino CLI's release build tasks: arduino/arduino-cli@5a5ae94 / arduino/arduino-cli#2103
Other information
In order to facilitate the review of this pull request, I performed a demonstration release with the proposed changes in my fork:
https://github.com/per1234/arduino-language-server/actions/runs/11789922878
https://github.com/per1234/arduino-language-server/releases/tag/0.0.0-rc.12